// src/router/menus.tsx
import type { MenuProps } from 'antd';
import { 
  HomeOutlined, 
  PictureOutlined, 
  UnorderedListOutlined, 
  AppstoreAddOutlined,
  ProfileOutlined,
  FileSearchOutlined,
  UserAddOutlined,
  UsergroupDeleteOutlined
} from "@ant-design/icons";
import Home from '@/views/Home/Index';
import BannerList from '@/views/banner/BannerList';
import BannerAdd from '@/views/banner/BannerAdd';
import ProList from '@/views/pro/ProList';
import ProSearch from '@/views/pro/ProSearch';
import AccountList from '@/views/account/AccountList';
import AccountAdmin from '@/views/account/AccountAdmin';
import Set from '@/views/set/index'
import Baidu from '@/views/map/Baidu';
import Gaode from '@/views/map/Gaode'
import EchartList from '@/views/echart/Index'
import Export from '@/views/inorout/Export';
import Import from '@/views/inorout/Import';
import Braft from '@/views/edit/Braft';
import Md from '@/views/edit/Md';
// 官方文档提供
type MenuItem = Required<MenuProps>['items'][number];
export type MyMenuItem = MenuItem & { // 自己扩展的类型
  path: string,
  label: string,
  icon?: React.ReactNode,
  redirect?: string,
  children?: MyMenuItem[]
  element?:React.ReactNode,
  hidden?: number
}
const menus: MyMenuItem[] = [
  {
    path: '/',
    key: '/',
    label: '系统首页',
    icon: <HomeOutlined />,
    element:<Home/>
  },
  {
    path: '/banner',
    key: '/banner',
    label: '轮播图管理',
    icon: <PictureOutlined />,
    redirect: '/banner/list',
    children: [
      {
        path: '/banner/list',
        key: '/banner/list',
        label: '轮播图列表',
        icon: <UnorderedListOutlined />,
        element:<BannerList/>
      },
      {
        path: '/banner/add',
        key: '/banner/add',
        label: '添加轮播图',
        icon: <AppstoreAddOutlined />,
        element:<BannerAdd/>,
        hidden:1
      }
    ]
  },
  {
    path: '/pro',
    key: '/pro',
    label: '商品管理',
    redirect: '/pro/list',
    icon: <ProfileOutlined />,
    children: [
      {
        path: '/pro/list',
        key: '/pro/list',
        label: '商品列表',
        icon: <UnorderedListOutlined />,
        element:<ProList/>
      },
      {
        path: '/pro/search',
        key: '/pro/search',
        label: '筛选列表',
        icon: <FileSearchOutlined />,
        element:<ProSearch/>
      },
    ]
  },
  {
    path: '/account',
    key: '/account',
    label: '账户管理',
    redirect: '/account/list',
    icon: <UsergroupDeleteOutlined />,
    children: [
      {
        path: '/account/list',
        key: '/account/list',
        label: '用户列表',
        icon: <UnorderedListOutlined />,
        element:<AccountList/>
      },
      {
        path: '/account/admin',
        key: '/account/admin',
        label: '管理员列表',
        icon: <UserAddOutlined />,
        element:<AccountAdmin/>
      }
    ]
  },
  {
    path: '/set',
    label: '设置',
    key: '/set',
    icon: <HomeOutlined />,
    element: <Set />,
    hidden: 1
  },
  {
    path: '/map',
    label: '地图',
    key: '/map',
    icon: <HomeOutlined />,
    redirect: '/map/baidu',
    children:[
      {
        path: '/map/baidu',
        label: '百度地图',
        key: '/map/baidu',
        icon: <HomeOutlined />,
        element: <Baidu />,
      },
      {
        path: '/map/gaode',
        label: '高德地图',
        key: '/map/gaode',
        icon: <HomeOutlined />,
        element: <Gaode />,
      }
    ]
  },
  {
    path: '/echart',
    label: 'echart',
    key: '/echart',
    icon: <HomeOutlined />,
    redirect: '/echart/list',
    children:[
      {
        path: '/echart/list',
        label: '流水图',
        key: '/echart/list',
        icon: <HomeOutlined />,
        element: <EchartList />,
      },
    ]
  },
  {
    path: '/inorout',
    label: '导出与导入',
    key: '/inorout',
    icon: <HomeOutlined />,
    redirect: '/inorout/out',
    children:[
      {
        path: '/inorout/out',
        label: '导出',
        key: '/inorout/out',
        icon: <HomeOutlined />,
        element: <Export/>,
      },
      {
        path: '/inorout/in',
        label: '导入',
        key: '/inorout/in',
        icon: <HomeOutlined />,
        element: <Import />,
      },
    ]
  },
  {
    path: '/edit',
    label: '编辑器',
    key: '/edit',
    icon: <HomeOutlined />,
    redirect: '/edit/braft',
    children:[
      {
        path: '/edit/braft',
        label: '富文本编辑器',
        key: '/edit/braft',
        icon: <HomeOutlined />,
        element: <Braft/>,
      },
      {
        path: '/edit/md',
        label: 'markdown编辑器',
        key: '/edit/md',
        icon: <HomeOutlined />,
        element: <Md />,
      },
    ]
  },
]

export default menus